<!DOCTYPE html>
<html lang="{{language}}">
    <head>
        <script type="text/javascript">
            var _speedMark = new Date();
        </script>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
        <meta name="Keywords" content="在线阅读 电子书 下载 推送 kindle epub mobi" />
        <meta name="description" content="这是个安静读书的地方。在线阅读Epub/Mobi/Pdf/Azw3等格式的电子书，也支持下载或推送到Kindle设备里。" />
        <meta property="qc:admins" content="24654762376414527736727" />
        <link href="{{static_url("css/bootstrap.min.css")}}" rel="stylesheet">
        <link href="{{static_url("css/star-rating.css")}}" rel="stylesheet">
        <link href="{{static_url("css/calibre.css")}}" rel="stylesheet">
        <!- [if IE]><script src="{{static_url("js/respond.js")}}"></script><![endif]->
        {% block title %}
        <title>{% if title %}{{title}} - {%endif%}奇异书屋</title>
        {% endblock %}
        {% block meta %}{% endblock %}
        <style>
body {font-family: 'PingFang SC', 'Source Han Sans CN', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, 'Heiti SC', sans-serif; }
.navbar-icon { float: right }
#navbar-btn-search { padding: 6px 14px; }

@media (min-width: 768px) {
.navbar-icon { display: none }
.navbar-collapse { float: left }
}
                #body .pagination li a { float: none; }
                #body .pagination { width: 99%; text-align: center; }

        </style>
    </head>

    <body id='body'>
        <nav class="navbar navbar-default" role="navigation">
            <!-- phone default navbar -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menu-box">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#search-box" id='navbar-btn-search'>
                    <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                </button>

                {% if request.user %}
                <a class="navbar-brand navbar-icon" href="/user">
                    <img style="margin-top:-6px;height:32px;width:32px" src={{request.user.avatar}}></img>
                </a>
                {% else %}
                <a class="navbar-brand navbar-icon" href="/login">
                    <span class="glyphicon glyphicon-user"></span>
                </a>
                {% endif %}

                <a class="navbar-brand logo" href="/">奇异书屋</a>
            </div>

            <div class="collapse navbar-collapse" id="menu-box">
                <ul class="nav navbar-nav">
                    <li {%if not nav or nav == "index" %}class="active"{%endif%} ><a href="/">书库</a></li>
                    <li {%if nav == "user" %}class="active"{%endif%} ><a href="/user">阅读记录</a></li>
                    <li {%if nav == "about" %}class="active"{%endif%} ><a href="/about">关于</a></li>
                </ul>
            </div>

            <div class="collapse navbar-collapse" id='search-box' >
                <form style="margin:10px auto" class="form-inline" action="/search" role="search">
                    <div class="input-group">
                        <input type="text" name="name" class="form-control" value="{{search_query}}" >
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit">
                                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            </button>
                        </span>
                    </div>
                </form>
            </div>

            <div class="collapse navbar-collapse navbar-right" id="user-box">
                <ul class="hidden-xs nav navbar-nav">
                    {% if request.user %}
                    <li>
                        <img class="hidden-xs" style="margin-top:9px;height:32px;width:32px" src={{request.user.avatar}}></img>
                    </li>
                    <li role="presentation" class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                            {{ request.user.username }}<span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="/setting"><span class="glyphicon glyphicon-cog"></span> 账号设置</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="/logout"><span class="glyphicon glyphicon-cog"></span> 退出账号</a></li>
                        </ul>
                    </li>
                    {% else %}
                    <li><a  class="navbar-brand" href="/login"><span class="glyphicon glyphicon-user"></span> 登录</a></li>
                    {% endif %}
                </ul>
            </div>
        </nav>

        <div class="container">
            <div class="row">
                {% for v in messages %}
                <div class="alert alert-{{v.status}} alert-dismissible" role="alert">
                    <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    {{ v.data.message }}
                </div>
                {% endfor %}

                {% block msgbar %}{% endblock %}
            </div>
            <div class="row">
                <div class="col-md-8">
                    {% block content %}{% endblock %}
                    <div class="clearfix"></div>
                </div>


                <!-- sidebar -->
                <div class="col-md-4">
                    <div class="row">
                    {% block sidebar %}{% endblock %}
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-8">
                    {% block content_footer %}{% endblock %}
                </div>
            </div>
        </div>
        <div class="col-md-12 footer">
            <p>
            本站基于<a href='//www.calibre-ebook.com'>Calibre</a>构建，感谢开源界的力量。本站所有资源搜集于互联网，如有侵权，请邮件联系。
            <br/>粤ICP备14073162号
            <br/>
            <a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=850f55ba2f019ad83c5df4d60f31f0b5db2b856b40b03ed6cfe698be5b4455e3"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="kindle阅读" title="kindle阅读"></a>
            </p>
        </div>
        <p>&nbsp;</p>

        {% block footer %}{% endblock %}
        <script src="{{static_url("js/jquery-1.11.1.min.js")}}"></script>
        <script src="{{static_url("js/bootstrap.min.js")}}"></script>
        <script src="{{static_url("js/spin.min.js")}}"></script>
        <script src="{{static_url("js/holder.js")}}"></script>
        <script src="{{static_url("js/star-rating.min.js")}}"></script>
        <script src="{{static_url("js/jquery.editable.min.js")}}"></script>
        <script src="{{static_url("js/jquery.cookie-1.4.1.min.js")}}"></script>
        <script src="{{static_url("js/calibre.js")}}"></script>
        <script src="{{static_url("js/jquery.lazyload.min.js")}}"></script>
        <script>
            (function() {
                if (! window.console ) {
                    window.console = {};
                    window.console.log = function() { };
                }
                if ( ! Object.keys ) {
                    Object.keys = function() { return [] };
                }
            }())
            $("img.lazy").lazyload();
            jQuery(".rating").rating({showClear: false, showCaption: false});
        </script>
        {% block script %}{% endblock %}
        <script async type="text/javascript" src="//tajs.qq.com/stats?sId=29043744" charset="UTF-8"></script>
        <!-- Global Site Tag (gtag.js) - Google Analytics -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=UA-45286404-1"></script>
        <script>
          window.dataLayer = window.dataLayer || [];
          function gtag(){dataLayer.push(arguments)};
          gtag('js', new Date());
          gtag('config', 'UA-45286404-1');
        </script>
    </body>
</html>
